//#define __DEBUG__
#define THIS_FILE "fn_checku.sqf"
#include "x_setup.sqf"

private ["_r", "_isalive"];
_r = true;_isalive = alive _this;
if (KEGs_playable_only && {!((_this in playableUnits) || {(_this in switchableUnits)})}) then {
	_r = false
} else {
	if (!isPlayer _this && {KEGs_AIfilter == 1}) exitWith {_r = false};
	if (_this == player) exitWith {};
	if (!_isalive && {KEGs_DeadFilter == 1}) exitWith {_r = false};
	if (KEGs_gfleader && {((_this != formationLeader _this) || {(_this != leader _this)})}) exitWith {_r = false};
	if (KEGs_CheckDist != -1 && {_this distance player > KEGs_CheckDist}) then {_r = false};
};
[_r, _isalive]